package com.lt.report.service.Impl;

import com.lt.report.service.ImportServiceInterFace;
import com.lt.report.service.UploadExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.io.InputStream;

@Slf4j
@Service
public class UploadExecutorImpl implements UploadExecutor {
    @Autowired
    ImportServiceInterFace importServiceInterFace;

    @Override
    @Async("asyncServiceExecutor")
    public void executeUpload(InputStream in, String fileName) {
        log.info("begin upload " + fileName);
        try {
            importServiceInterFace.getBankListByExcel(in, fileName);
        } catch (Exception e) {
            e.printStackTrace();
        }
        log.info("end upload" + fileName);
    }
}
